package com.android.infantschool.util;

import com.android.infantschool.bean.BaseBean;
import com.google.gson.Gson;

/**
 * author cowards
 * created on 2019\7\24 0024
 **/
public class JsonGet {

    /**
     * 解析通用方法
     *
     * @param data     要解析的json字符串
     * @param baseBean 要转换后的Javabean对象
     * @param <T>      Javabean对象
     * @return
     */
    public static <T> T getGson(String data, BaseBean baseBean) {
        baseBean = new Gson().fromJson(data, baseBean.getClass());
        return (T) baseBean;
    }
}